<template>
  <div class="home-favorite-card">
    <div>
      <home-favorite-item
        v-for="channel of channels"
        :key="channel.handler"
        :channel="channel"
        @on-click="clickHandler(channel)"></home-favorite-item>
    </div>
    <p class="home-favorite-tips">为避免因官网被封，导致您无法正常观影请收藏上列网址，我们第一时间发布最新网址</p>
  </div>
</template>

<script>
import HomeFavoriteItem from './home-favorite-item';

export default {
  name: 'home-favorite-card',

  components: {
    [HomeFavoriteItem.name]: HomeFavoriteItem
  },

  data () {
    return {
      channels: [
        {
          name: '官方网址',
          url: 'http://77hlw.com',
          icon: require('../../../assets/images/landing_icon_1.png'),
          btnText: '保存官网到桌面',
          handler: 'on-save'
        },
        {
          name: '网址发布',
          url: 'https://github.com/huluwaservice/webapp/blob/master/README.md',
          icon: require('../../../assets/images/landing_icon_2.png'),
          btnText: '收藏',
          handler: 'on-favorite'
        },
        {
          name: '影视交流群',
          url: '',
          icon: require('../../../assets/images/landing_icon_3.png'),
          btnText: '加入',
          handler: 'on-join'
        },
        {
          name: '邮箱',
          url: 'huluwaservice@gmail.com',
          icon: require('../../../assets/images/landing_icon_4.png'),
          btnText: '复制',
          handler: 'on-copy'
        }
      ]
    };
  },

  methods: {
    clickHandler (channel) {
      if (!channel.handler) {
        return;
      }
      this.$emit(channel.handler, channel);
    }
  }
};
</script>

<style lang="scss" scoped>
.home-favorite-card {
  margin: 0 8px;
  padding: 180px 0 40px;
  display: flex;
  flex-flow: column nowrap;
  justify-content: space-between;
  height: 720px;
  background: url("../../../assets/images/card_bg.png") no-repeat top left / 100% 100%;

  .home-favorite-tips {
    padding: 0 115px;
    line-height: 31.5px;
    text-align: center;
    font-size: 24px;
    color: rgba(137, 116, 172, 0.6);
  }
}
</style>
